package cn.cdeden.knowledge.dubbo;

import cn.cdeden.common.core.utils.MapstructUtils;
import cn.cdeden.knowledge.api.domain.RemotePersonalTreeService;
import cn.cdeden.knowledge.api.domain.RemoteTeamFileTreeService;
import cn.cdeden.knowledge.api.domain.vo.RemotePersonalTreeVo;
import cn.cdeden.knowledge.api.domain.vo.RemoteTeamFilesTreeVo;
import cn.cdeden.knowledge.domain.PersonalFilesTree;
import cn.cdeden.knowledge.domain.TeamFilesTree;
import cn.cdeden.knowledge.service.PersonalFilesTreeService;
import cn.cdeden.knowledge.service.TeamFilesTreeService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@RequiredArgsConstructor
@Service
@DubboService
public class RemoteTeamFileTreeServiceImpl implements RemoteTeamFileTreeService {

    private final TeamFilesTreeService teamFilesTreeService;

    @Override
    public RemoteTeamFilesTreeVo getById(String userId) {
        return MapstructUtils.convert(teamFilesTreeService.getById(userId),RemoteTeamFilesTreeVo.class);
    }

    @Override
    public RemoteTeamFilesTreeVo nameRechecking(String realName, String parentId, String suffix) {
        return MapstructUtils.convert(teamFilesTreeService.nameRechecking(realName,parentId,suffix),RemoteTeamFilesTreeVo.class);
    }

    @Override
    public boolean saveBatch(List<RemoteTeamFilesTreeVo> filesTrees) {
        return teamFilesTreeService.saveBatch(MapstructUtils.convert(filesTrees, TeamFilesTree.class));
    }
}
